package org.chuan.hisports.controller;

import org.chuan.hisports.entity.FitnessAdmin;
import org.chuan.hisports.service.FitnessAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller("fitness")
@RequestMapping("fitness")
@ResponseBody
public class FitnessController {
     @Autowired
     FitnessAdminService fitnessAdminService;
    @RequestMapping("login")
    public Object login(@RequestParam("username") String username,
                      @RequestParam("password") String password){
        FitnessAdmin fitnessAdmin = fitnessAdminService.login(username,password);
        if (fitnessAdmin == null){
            return "password error";
        }

        return fitnessAdmin;
    }
}
